import logging
from datetime import timedelta

from redis.client import StrictRedis


class Config(object):
    DEBUG = True
    SECRET_KEY = "guojiaru"
    # 数据库配置信息
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:han@localhost:3307/newsinformation"
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN=True
    # redis配置信息
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # session配置信息
    SESSION_TYPE = "redis"  # 设置session存储类型
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)  # 指定session存储的redis服务器
    SESSION_USE_SIGNER = True  # 设置签名存储
    PERMANENT_SESSION_LIFETIME = timedelta(days=2)  # 设置session有效期,两天时间

    #默认日志级别
    LEVEL_NAME=logging.DEBUG
#测试环境
class TestConfig(Config):
    pass

#开发环境
class devoConfig(Config):
    pass
config_dict={
    "develop_Config":Config,
    "Test_Config":TestConfig
}